package com.aispeech.asr.clib.decoder;

public enum EAudioCodec {
    WAV(0),
    MP3(1),
    OGG(2),
    AMR(3),
//    FLV(4),
    TEXT(5),
    OPUS(6),
    OGG_OPUS(7),
    SPEEX(8),
    OKI_ADPCM(9),
    SBC(10);

    private final int value;

    EAudioCodec(int value) {
        this.value = value;
    }

    public static EAudioCodec from(String name) {
        EAudioCodec codec = null;

        if (name == null) return codec;
        if ("pcm".equalsIgnoreCase(name)) name = "wav";

        for (EAudioCodec type : EAudioCodec.values()) {
            if (type.key().equals(name.toLowerCase())) {
                codec = type;
                break;
            }
        }

        return codec;
    }

    public int value() {
        return value;
    }

    public String key() {
        return this.toString().toLowerCase();
    }
}
